//
//  EduCell.m
//  HubeiHotel
//
//  Created by 张露杰 on 18/4/4.
//  Copyright © 2018年 张露杰. All rights reserved.
//

#import "EduCell.h"
#import "UILabel+HWDUILabel.h"

@implementation EduCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self loadCell];
    }
    return self;
}

-(void)loadCell
{
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
    
    //时间
    _timeLab = [UILabel new];
    _timeLab.textColor = TextBlack;
    _timeLab.font = [UIFont systemFontOfSize:14*screenW_6];
    _timeLab.text = @" ";
    [self.contentView  addSubview:_timeLab];
    [_timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(25*screenW_6);
        make.width.equalTo(@(SCREENW-100*screenW_6));
        make.top.equalTo(self.contentView).offset(20*screenW_6);
    }];
    
    
    //按钮
    _chooseBtn = [[HotelBTnView alloc]initWithFrame:CGRectMake(SCREENW-70*screenW_6,15*screenW_6,60*screenW_6,25*screenW_6) Title:@"编辑" NomolImageV:@"edit" SelectImageV:@"" IsSelect:NO];
    _chooseBtn.userInteractionEnabled = YES;
    _chooseBtn.hidden = YES;
    _chooseBtn.titleLab.textColor = TextRed;
    [self.contentView addSubview:_chooseBtn];
    
    
    //名称
    _nameLab = [UILabel new];
    _nameLab.textColor = TextBlack;
    _nameLab.font = [UIFont systemFontOfSize:14*screenW_6];
    _nameLab.text = @" ";
    _nameLab.numberOfLines = 0;
    [self.contentView  addSubview:_nameLab];
    [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(25*screenW_6);
        make.right.equalTo(self.contentView ).offset(-25*screenW_6);
        make.top.equalTo(_timeLab.mas_bottom).offset(15*screenW_6);
    }];
    
    //详细内容
    _detailLab = [UILabel new];
    _detailLab.textColor = TextGray;
    _detailLab.font = [UIFont systemFontOfSize:14*screenW_6];
    _detailLab.text = @" ";
    _detailLab.numberOfLines = 0;
    [self.contentView  addSubview:_detailLab];
    [_detailLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(25*screenW_6);
        make.right.equalTo(self.contentView ).offset(-25*screenW_6);
        make.top.equalTo(_nameLab.mas_bottom).offset(10*screenW_6);
    }];
    
    //画线
    _lineLab = [UILabel new];
    _lineLab.backgroundColor = LineColor;
    _lineLab.text = @" ";
    [self.contentView  addSubview:_lineLab];
    [_lineLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.height.equalTo(@1);
        make.top.equalTo(_detailLab.mas_bottom).offset(20*screenW_6);
        make.bottom.equalTo(self.contentView).offset(0);
    }];
    
}

-(void)setDataDic:(NSDictionary *)dataDic
{
    _timeLab.text = [NSString stringWithFormat:@"%@毕业",[dataDic[@"graduationTime"] componentsSeparatedByString:@" "][0]];
    _nameLab.text = [NSString stringWithFormat:@"%@",dataDic[@"schoolName"]];
    _detailLab.text = dataDic[@"major"];
    [_detailLab setLineSpaceWithLineSpacing:8*screenW_6 text:_detailLab.text];
    
}

@end
